home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / e_os300b / resource / eos.inc < prev    next >
Encoding:
Text File  |  1996-12-02  |  102.7 KB  |  2,034 lines

  1.  
  2. ;╔══════════════════════════════════════════════════════════════════════════╗
  3. ;║                                                                          ║
  4. ;║ EOS.INC (Tabs : 13 21 29 37)                                             ║
  5. ;║                                                                          ║
  6. ;╚══════════════════════════════════════════════════════════════════════════╝
  7.  
  8. ;╔══════════════════════════════════════════════════════════════════════════╗
  9. ;║                                                                          ║
  10. ;║ EOS Variables                                                            ║
  11. ;║                                                                          ║
  12. ;╚══════════════════════════════════════════════════════════════════════════╝
  13.  
  14.  
  15. ;──────────────────────────────────────────────────────────────────────────────
  16. ; MASM Declarations
  17. ;──────────────────────────────────────────────────────────────────────────────
  18.  
  19. IFNDEF  ??version
  20.      Global EQU  Externdef
  21. ENDIF
  22.  
  23. ;──────────────────────────────────────────────────────────────────────────────
  24. ; Versions
  25. ;──────────────────────────────────────────────────────────────────────────────
  26.  
  27. Ver_EOS             equ db '3.00ß'
  28. Ver_Diamond         equ db '3.00ß'
  29. Ver_Vesa            equ db '3.00ß'
  30. Ver_Fli32           equ db '3.00ß'
  31. Ver_Debug           equ db '3.00ß'
  32. Ver_Snap            equ db '3.00ß'
  33. Ver_Joystick        equ db '3.00ß'
  34. Ver_Edconfig        equ db '3.00ß'
  35. Ver_Memory          equ db '3.00ß'
  36.  
  37.  
  38. ;──────────────────────────────────────────────────────────────────────────────
  39. ; Key_Map (Azerty)
  40. ;──────────────────────────────────────────────────────────────────────────────
  41.  
  42. All         = 0
  43. Escape      = 1
  44. Return      = 28
  45. Alt         = 56
  46. Space       = 57
  47. Left        = 75
  48. Right       = 77
  49. Up          = 72
  50. Down        = 80
  51. Plus        = 78
  52. Moins       = 74
  53. Ctrl        = 29
  54. Num_1       = 79
  55. Num_2       = 80
  56. Num_3       = 81
  57. Num_4       = 75
  58. Num_5       = 76
  59. Num_6       = 77
  60. Num_7       = 71
  61. Num_8       = 72
  62. Num_9       = 73
  63. Num_0       = 82
  64. Key_1       = 02
  65. Key_2       = 03
  66. Key_3       = 04
  67. Key_4       = 05
  68. Key_5       = 06
  69. Key_6       = 07
  70. Key_7       = 08
  71. Key_8       = 09
  72. Key_9       = 10
  73. Key_0       = 11
  74. Key_A       = 16
  75. Key_Z       = 17
  76. Key_E       = 18
  77. Key_R       = 19
  78. Key_T       = 20
  79. Key_Y       = 21
  80. Key_U       = 22
  81. Key_I       = 23
  82. Key_O       = 24
  83. Key_P       = 25
  84. Key_Q       = 30
  85. Key_S       = 31
  86. Key_D       = 32
  87. Key_F       = 33
  88. Key_G       = 34
  89. Key_H       = 35
  90. Key_J       = 36
  91. Key_K       = 37
  92. Key_L       = 38
  93. Key_M       = 39
  94. Key_W       = 44
  95. Key_X       = 45
  96. Key_C       = 46
  97. Key_V       = 47
  98. Key_B       = 48
  99. Key_N       = 49
  100. Key_F1      = 59
  101. Key_F2      = 60
  102. Key_F3      = 61
  103. Key_F4      = 62
  104. Key_F5      = 63
  105. Key_F6      = 64
  106. Key_F7      = 65
  107. Key_F8      = 66
  108. Key_F9      = 67
  109. Key_F10     = 68
  110. Key_F11     = 87
  111. Key_F12     = 88
  112.  
  113. ;──────────────────────────────────────────────────────────────────────────────
  114. ; Others
  115. ;──────────────────────────────────────────────────────────────────────────────
  116.  
  117. Impossible  = 0     ; For the cut and paste (Ever 0)
  118.  
  119. On          = 1
  120. Off         = 0
  121.  
  122. vbl         = 1
  123.  
  124.  
  125. Int_Val_EOS = 61h
  126. Int_EOS     Equ Int Int_Val_EOS
  127.  
  128. B Equ Byte Ptr
  129. W Equ Word Ptr
  130. D Equ Dword Ptr
  131. F Equ Fword Ptr
  132. O Equ Offset
  133.  
  134. RAW         equ 01h
  135. XMS         equ 02h
  136. VCPI        equ 04h
  137. DPMI        equ 08h
  138.  
  139.  
  140. ;╔══════════════════════════════════════════════════════════════════════════╗
  141. ;║                                                                          ║
  142. ;║ EOS Macros                                                               ║
  143. ;║                                                                          ║
  144. ;╚══════════════════════════════════════════════════════════════════════════╝
  145.  
  146.  
  147. Color       macro c,x,y,z
  148.         if vbl
  149.             pushfd
  150.             push edx
  151.             push eax
  152.     mov dx,3c8h
  153.             mov al,c
  154.     out dx,al
  155.     inc dx
  156.             mov al,x
  157.     out dx,al
  158.             mov al,y
  159.     out dx,al
  160.             mov al,z
  161.     out dx,al
  162.             pop eax
  163.             pop edx
  164.             popfd
  165.         endif
  166.     endm
  167.  
  168. Send        macro value,x,y
  169.             pushad
  170.             pushfd
  171.             mov edx,value
  172.             mov bx,x
  173.             mov cx,y
  174.             mov ah,Set_Value_Mono
  175.             Int_EOS
  176.             popfd
  177.             popad
  178.             endm
  179.  
  180. Get_Param   macro name
  181. local @@no_path
  182.             mov esi,cs:[Psp_Addr]
  183.             add esi,80h
  184.             mov cl,byte ptr [esi]
  185.             and ecx,0ffh
  186.             mov byte ptr [esi],0
  187.             je @@no_path
  188.             mov edi,offset name
  189.             add esi,2
  190.             rep movsb
  191.             mov Byte ptr es:[edi-1],0
  192. @@no_path:
  193.             endm
  194.  
  195. Break_Point macro
  196.             int 3
  197.             endm
  198.  
  199.  
  200. ;╔══════════════════════════════════════════════════════════════════════════╗
  201. ;║                                                                          ║
  202. ;║ EOS Functions                                                            ║
  203. ;║                                                                          ║
  204. ;╚══════════════════════════════════════════════════════════════════════════╝
  205.  
  206.  
  207. ;╔══════════════════════════════════════════════════════════════════════════╗
  208. ;║                                                                          ║
  209. ;║                                System                                    ║
  210. ;║                                                                          ║
  211. ;╚══════════════════════════════════════════════════════════════════════════╝
  212.  
  213.  
  214. ;┌──────────────────────────────────────────────────────────────────────────┐
  215. ;│Exit Error   Restore initial Video mode , interrupts , free all reserved  │
  216. ;│             memory ,stop music if played and exit (with error code 1)    │
  217. ;│             with a error message                                         │
  218. ;│                                                                          │
  219. ;│In :                                                                      │
  220. ;│        AH = Exit_Error                                                   │
  221. ;│    DS:EDX = Offset message to display                                    │
  222. ;│                                                                          │
  223. ;│Out :                                                                     │
  224. ;│                                                                          │
  225. ;│Other Registers Change : None                                             │
  226. ;│                                                                          │
  227. ;│                                                                          │
  228. ;└──────────────────────────────────────────────────────────────────────────┘
  229. Exit_Error = 1h
  230. If Impossible
  231.             mov ah,Exit_Error
  232.             mov edx,Offset Error_Txt
  233.             Int_EOS
  234. EndIf
  235.  
  236.  
  237. ;┌──────────────────────────────────────────────────────────────────────────┐
  238. ;│Use Int 08   Use Int 08 (IRQ 0) to count frame rate and have a stable     │
  239. ;│             vertical retrace                                             │
  240. ;│             Defaults frequency is 70Hz                                   │
  241. ;│                                                                          │
  242. ;│In :                                                                      │
  243. ;│        AH = Use_Int_08                                                   │
  244. ;│        BX = On Enable Int 08                                             │
  245. ;│           = Off Disable Int 08                                           │
  246. ;│                                                                          │
  247. ;│                                                                          │
  248. ;│Out :                                                                     │
  249. ;│                                                                          │
  250. ;│                                                                          │
  251. ;│Other Registers Change : None                                             │
  252. ;│                                                                          │
  253. ;│                                                                          │
  254. ;└──────────────────────────────────────────────────────────────────────────┘
  255. Use_Int_08          = 02h
  256. If Impossible
  257.             mov ah,Use_Int_08
  258.             mov bx,On
  259.             Int_EOS
  260. EndIf
  261.  
  262.  
  263. ;┌──────────────────────────────────────────────────────────────────────────┐
  264. ;│Change Synchro Int 08   Change frequency for Interupt 08                  │
  265. ;│                        Defaults frequency is 70Hz                        │
  266. ;│                                                                          │
  267. ;│In :                                                                      │
  268. ;│        BX = frequency                                                    │
  269. ;│        AH = Change_Synchro_Int_08                                        │
  270. ;│                                                                          │
  271. ;│Out :                                                                     │
  272. ;│                                                                          │
  273. ;│                                                                          │
  274. ;│Other Registers Change : None                                             │
  275. ;│                                                                          │
  276. ;│                                                                          │
  277. ;└──────────────────────────────────────────────────────────────────────────┘
  278. Change_Synchro_Int_08      = 03h
  279. If Impossible
  280.             mov bx,70                   ; 70hz
  281.             mov ah,Change_Synchro_Int_08
  282.             Int_EOS
  283. EndIf
  284.  
  285.  
  286. ;┌──────────────────────────────────────────────────────────────────────────┐
  287. ;│Use Int 09   Use Internal Keyboard handler to use keyboard                │
  288. ;│                                                                          │
  289. ;│In :                                                                      │
  290. ;│        AH = Use_Int_09                                                   │
  291. ;│        BX = On Enable Int 09                                             │
  292. ;│           = Off Disable Int 09 (Default setting)                         │
  293. ;│                                                                          │
  294. ;│                                                                          │
  295. ;│Out :                                                                     │
  296. ;│                                                                          │
  297. ;│                                                                          │
  298. ;│Other Registers Change : None                                             │
  299. ;│                                                                          │
  300. ;│                                                                          │
  301. ;└──────────────────────────────────────────────────────────────────────────┘
  302.  
  303. Global Key_Map      : Byte  ; Offset of the Key_Mapping
  304.  
  305. Use_Int_09          = 04h
  306. If Impossible
  307.             mov ah,Use_Int_09
  308.             mov bx,On
  309.             Int_EOS
  310.  
  311.             ...
  312.  
  313. @@Pause:                            ; Test if key pressed
  314.             cmp Key_Map[All],Off
  315.             je @@Pause
  316.             mov Key_Map[All],Off
  317.  
  318.             ...
  319.  
  320. @@Pause:                            ; Test if the Esc key is pressed
  321.             cmp Key_Map[Escape],On  ; Actually
  322.             jne @@Pause
  323.  
  324.             ...
  325.  
  326. @@Pause:                            ; Test if the ESC key have been pressed
  327.             cmp Key_Map[All],Escape
  328.             jne @@Pause
  329. EndIf
  330.  
  331.  
  332. ;┌──────────────────────────────────────────────────────────────────────────┐
  333. ;│Restore Video Mode   Restore the inital video which is be active at the   │
  334. ;│                     start of the program                                 │
  335. ;│                                                                          │
  336. ;│In :                                                                      │
  337. ;│        AH = Restore_Video_Mode                                           │
  338. ;│                                                                          │
  339. ;│Out :                                                                     │
  340. ;│                                                                          │
  341. ;│Other Registers Change : None                                             │
  342. ;│                                                                          │
  343. ;│                                                                          │
  344. ;└──────────────────────────────────────────────────────────────────────────┘
  345. Restore_Video_Mode  = 07h
  346. If Impossible
  347.             mov ah,Restore_Video_Mode
  348.             Int_EOS
  349. EndIF
  350.  
  351. ;┌──────────────────────────────────────────────────────────────────────────┐
  352. ;│Detect Windows       Detect If Windows is running                         │
  353. ;│                                                                          │
  354. ;│In :                                                                      │
  355. ;│        AH = Detect_Windows                                               │
  356. ;│                                                                          │
  357. ;│Out :                                                                     │
  358. ;│        AL = Windows version                                              │
  359. ;│                                                                          │
  360. ;│Other Registers Change : None                                             │
  361. ;│                                                                          │
  362. ;│                                                                          │
  363. ;└──────────────────────────────────────────────────────────────────────────┘
  364. Detect_Windows      = 0Ah
  365. Windows_3x          = 3
  366. Windows_95          = 4
  367. If Impossible
  368.             lea edx,Windows_Txt
  369.             mov ah,Detect_Windows
  370.             Int_EOS
  371.             or al,al
  372.             jnz Error
  373.  
  374.             ...
  375.  
  376. Windows_Txt         db "    ■ Sorry, but this program can not run under Microsoft Windows (tm)",13,10,36
  377. EndIF
  378.  
  379. ;┌──────────────────────────────────────────────────────────────────────────┐
  380. ;│Direct Send          Write a text directly to video ram . Color allowed   │
  381. ;│                                                                          │
  382. ;│In :                                                                      │
  383. ;│        AH = Direct_Send                                                  │
  384. ;│       EDX = Offset message to Display                                    │
  385. ;│                                                                          │
  386. ;│Out :                                                                     │
  387. ;│                                                                          │
  388. ;│Other Registers Change : None                                             │
  389. ;│                                                                          │
  390. ;│Command : 0,0      = end                                                  │
  391. ;│          0,1..255 = color                                                │
  392. ;│          13       = first colonne                                        │
  393. ;│          10       = next ligne                                           │
  394. ;│                                                                          │
  395. ;└──────────────────────────────────────────────────────────────────────────┘
  396. Direct_Send         = 0Eh
  397. If Impossible
  398.             lea edx,Message
  399.             mov ah,Direct_Send
  400.             Int_EOS
  401.  
  402.             ...
  403.  
  404. Message             db "    ",0,1,"■ Color Blue ",0,4,"Red ",13,10,0,0
  405. EndIF
  406.  
  407.  
  408. ;╔══════════════════════════════════════════════════════════════════════════╗
  409. ;║                                                                          ║
  410. ;║                                 Files                                    ║
  411. ;║                                                                          ║
  412. ;╚══════════════════════════════════════════════════════════════════════════╝
  413.  
  414.  
  415. ;┌──────────────────────────────────────────────────────────────────────────┐
  416. ;│Load Internal File   Load a file which is link with LLINK                 │
  417. ;│                     if the file is not present the program stop and      │
  418. ;│                     display a error message                              │
  419. ;│                                                                          │
  420. ;│In :                                                                      │
  421. ;│        AH = Load_Internal_File                                           │
  422. ;│       EDX = Offset of file name                                          │
  423. ;│                                                                          │
  424. ;│Out :                                                                     │
  425. ;│       EAX = Logical address of buffer (work with Data32_Sel)             │
  426. ;│       ECX = Number of bytes read                                         │
  427. ;│       ESI = Physical address of buffer (work with Flat_Data_Sel)         │
  428. ;│                                                                          │
  429. ;│Other Registers Change : None                                             │
  430. ;│                                                                          │
  431. ;│                                                                          │
  432. ;└──────────────────────────────────────────────────────────────────────────┘
  433. Load_Internal_File  = 10h
  434. If Impossible
  435.             mov ah,Load_Internal_File
  436.             mov edx,O File_name
  437.             Int_EOS
  438.             mov [File_Buffer],eax
  439. EndIf
  440.  
  441.  
  442. ;┌──────────────────────────────────────────────────────────────────────────┐
  443. ;│Load External File   Load a external file and uncompress it if it has     │
  444. ;│                     been compress with Diet 1.44                         │
  445. ;│                                                                          │
  446. ;│In :                                                                      │
  447. ;│        AH = Load_External_File                                           │
  448. ;│       EDX = Offset of file name                                          │
  449. ;│                                                                          │
  450. ;│Out :                                                                     │
  451. ;│       Carry = 0                                                          │
  452. ;│        All done                                                          │
  453. ;│       EAX = Logical address of buffer (work with Data32_Sel)             │
  454. ;│       ECX = Number of bytes read                                         │
  455. ;│       ESI = Physical address of buffer (work with Flat_Data_Sel)         │
  456. ;│                                                                          │
  457. ;│                                                                          │
  458. ;│       Carry = 1                                                          │
  459. ;│        Error                                                             │
  460. ;│       EAX = 1 File Not Found                                             │
  461. ;│             2 Not Enough Memory                                          │
  462. ;│                                                                          │
  463. ;│Other Registers Change : None                                             │
  464. ;│                                                                          │
  465. ;│                                                                          │
  466. ;└──────────────────────────────────────────────────────────────────────────┘
  467. Load_External_File  = 11h
  468. If Impossible
  469.             mov ah,Load_External_File
  470.             mov edx,O File_name
  471.             Int_EOS
  472.             jc Error_File
  473.             mov [File_Buffer],eax
  474. EndIf
  475.  
  476.  
  477. ;┌──────────────────────────────────────────────────────────────────────────┐
  478. ;│Load Internal File Handle  Load a file which is link with LLINK           │
  479. ;│                           if the file is not present the program stop and│
  480. ;│                           display a error message                        │
  481. ;│                                                                          │
  482. ;│In :                                                                      │
  483. ;│        AH = Load_Internal_File_Handle                                    │
  484. ;│       EDX = Offset of file name                                          │
  485. ;│                                                                          │
  486. ;│Out :                                                                     │
  487. ;│       EAX = Logical address of buffer (work with Data32_Sel)             │
  488. ;│       ECX = Number of bytes read                                         │
  489. ;│       ESI = Physical address of buffer (work with Flat_Data_Sel)         │
  490. ;│       EDI = Handle of Memory                                             │
  491. ;│                                                                          │
  492. ;│Other Registers Change : None                                             │
  493. ;│                                                                          │
  494. ;│                                                                          │
  495. ;└──────────────────────────────────────────────────────────────────────────┘
  496. Load_Internal_File_Handle  = 12h
  497. If Impossible
  498.             mov ah,Load_Internal_File_Handle
  499.             mov edx,O File_name
  500.             Int_EOS
  501.             mov [File_Buffer],eax
  502.             mov [Handle_Memory],edi
  503. EndIf
  504.  
  505.  
  506. ;┌──────────────────────────────────────────────────────────────────────────┐
  507. ;│Load External File Handle  Load a external file and uncompress it if it   │
  508. ;│                           has been compress with Diet 1.44               │
  509. ;│                                                                          │
  510. ;│In :                                                                      │
  511. ;│        AH = Load_External_File_Handle                                    │
  512. ;│       EDX = Offset of file name                                          │
  513. ;│                                                                          │
  514. ;│Out :                                                                     │
  515. ;│       Carry = 0                                                          │
  516. ;│        All done                                                          │
  517. ;│       EAX = Logical address of buffer (work with Data32_Sel)             │
  518. ;│       ECX = Number of bytes read                                         │
  519. ;│       ESI = Physical address of buffer (work with Flat_Data_Sel)         │
  520. ;│       EDI = Handle of Memory                                             │
  521. ;│                                                                          │
  522. ;│                                                                          │
  523. ;│       Carry = 1                                                          │
  524. ;│        Error                                                             │
  525. ;│       EAX = 1 File Not Found                                             │
  526. ;│             2 Not Enough Memory                                          │
  527. ;│                                                                          │
  528. ;│Other Registers Change : None                                             │
  529. ;│                                                                          │
  530. ;│                                                                          │
  531. ;└──────────────────────────────────────────────────────────────────────────┘
  532. Load_External_File_Handle  = 13h
  533. If Impossible
  534.             mov ah,Load_External_File_Handle
  535.             mov edx,O File_name
  536.             Int_EOS
  537.             jc Error_File
  538.             mov [File_Buffer],eax
  539.             mov [Handle_Memory],edi
  540. EndIf
  541.  
  542.  
  543. ;┌──────────────────────────────────────────────────────────────────────────┐
  544. ;│Write External File  Save a File on a Disk                                │
  545. ;│                                                                          │
  546. ;│Entree :                                                                  │
  547. ;│        AH = Write_External_File                                          │
  548. ;│       ECX = Size Of File                                                 │
  549. ;│       EDX = Offset of file name                                          │
  550. ;│       ESI = Buffer address                                               │
  551. ;│                                                                          │
  552. ;│Sortie :                                                                  │
  553. ;│       Carry = 0                                                          │
  554. ;│        Tout Va Bien                                                      │
  555. ;│                                                                          │
  556. ;│       Carry = 1                                                          │
  557. ;│        Erreur  Can't write file                                          │
  558. ;│                                                                          │
  559. ;│Other Registers Change : None                                             │
  560. ;│                                                                          │
  561. ;│                                                                          │
  562. ;└──────────────────────────────────────────────────────────────────────────┘
  563. Write_External_File  = 14h
  564. If Impossible
  565.             mov ah,Write_External_File
  566.             mov edx,O File_name
  567.             mov esi,[Buffer]
  568.             mov ecx,[Size_Buffer]
  569.             Int_EOS
  570.             jc Error_File
  571. EndIf
  572.  
  573.  
  574. ;╔══════════════════════════════════════════════════════════════════════════╗
  575. ;║                                                                          ║
  576. ;║                              Synchronization                             ║
  577. ;║                                                                          ║
  578. ;╚══════════════════════════════════════════════════════════════════════════╝
  579.  
  580.  
  581. ;┌──────────────────────────────────────────────────────────────────────────┐
  582. ;│Wait Vbl   Wait the vertical retrace                                      │
  583. ;│                                                                          │
  584. ;│In :                                                                      │
  585. ;│                                                                          │
  586. ;│Out :                                                                     │
  587. ;│       EAX = Number of Vbl lost since the last call                       │
  588. ;│             (work only when the Int 08 is on)                            │
  589. ;│                                                                          │
  590. ;│Other Registers Change : None                                             │
  591. ;│                                                                          │
  592. ;│                                                                          │
  593. ;└──────────────────────────────────────────────────────────────────────────┘
  594. Wait_Vbl            = 20h
  595. If Impossible
  596.             mov ah,Wait_Vbl
  597.             Int_EOS
  598. EndIf
  599.  
  600.  
  601. ;╔══════════════════════════════════════════════════════════════════════════╗
  602. ;║                                                                          ║
  603. ;║                              Diamond Player                              ║
  604. ;║                                                                          ║
  605. ;╚══════════════════════════════════════════════════════════════════════════╝
  606.  
  607.  
  608. ;──────────────────────────────────────────────────────────────────────────────
  609. ; Diamond Player Declaration
  610. ;──────────────────────────────────────────────────────────────────────────────
  611.  
  612.   Global    Sound_Card_Type         : Byte
  613.   Global    Sound_Card_Port         : Word
  614.   Global    Sound_Card_Irq          : Byte
  615.   Global    Sound_Card_Dma          : Byte
  616.   Global    Master_Volume           : Byte
  617.   Global    Master_Volume_Sfx       : Byte
  618.   Global    Current_Pattern         : Byte
  619.   Global    Current_Note            : Byte
  620.   Global    Current_Speed           : Byte
  621.   Global    Current_BPM             : Byte
  622.   Global    Index_Pattern_Order     : Dword
  623.   Global    Pattern_Order           : Byte
  624.   Global    Number_Channel          : Dword
  625.   Global    Diamond_Channel         : MS
  626.  
  627.  
  628.   No_Card    = 0
  629.   Sb_10      = 01h
  630.   Sb_15      = 02h
  631.   Sb_20      = 03h
  632.   Sb_Pro     = 04h
  633.   Sb_16      = 05h
  634.   Sb_Awe     = 06h
  635.   Gravis     = 10h
  636.   Gravis_Max = 11h
  637.   Gravis_Ace = 12h
  638.   Gravis_Pnp = 13h
  639.   WSS        = 20h
  640.  
  641. MS         struc
  642. Current_Sample      dd      0
  643. Porta               dw      ?
  644. Tremelo             db      ?
  645. Current_Position    dd      ?
  646. Current_Low_Position dd     ?               ; Low Frac of the Current Position
  647. Jump_0e6            db      ?
  648. Compt_jump_0e6      db      ?
  649. Flags_0e6           db      ?
  650. Porta_Freq          dw      ?
  651. Porta_To            dw      ?
  652. Vibrato             db      ?
  653. Vibrato_Flag        db      ?
  654. FineTune            dw      ?
  655. Last_Effect         dd      0
  656. Voice               db      ?               ; Soit 1 ou 16 Soit 2 ou 17 etc ....
  657. Sample_volume       db      ?
  658. Base_Sample_Volume  db      ?
  659. Mute                db      ?               ; On Arrete la voie
  660. Frequence           dw      ?
  661. Compt_Frequence     dd      ?
  662. New_sample          db      ?
  663. Arp                 dw      ?,?,?
  664. Arp_Counter         dw      ?
  665. Slide_volume        dw      ?
  666. Panning             db      ?
  667. Retrig_Note         db      ?
  668. Retrig_Note_Val     db      ?
  669. Cut_Note            db      ?
  670. Delay_Note          db      ?
  671.                     db      0
  672. Delay_Note_Offset   dd      ?
  673. Addr_Read_Again     dd      ?               ; Addresse pour la routine Delay
  674.  
  675.  
  676. MS        ends
  677.  
  678. ;┌──────────────────────────────────────────────────────────────────────────┐
  679. ;│Detect Sound Card   Detect with the environment variable the sound        │
  680. ;│                    card installed                                        │
  681. ;│                                                                          │
  682. ;│In :                                                                      │
  683. ;│        AH = Detect_Sound_Card                                            │
  684. ;│        CX = 1  Display result of Searching                               │
  685. ;│                                                                          │
  686. ;│Out :                                                                     │
  687. ;│        AX = 0  No_Card                                                   │
  688. ;│           = 1  Sound Blaster 1.0                                         │
  689. ;│           = 2  Sound Blaster 1.5                                         │
  690. ;│           = 3  Sound Blaster 2.0                                         │
  691. ;│           = 4  Sound Blaster Pro                                         │
  692. ;│           = 5  Sound Blaster 16                                          │
  693. ;│           = 6  Sound Blaster Awe 32                                      │
  694. ;│           = 10h  Gus                                                     │
  695. ;│           = 11h  Gus Max                                                 │
  696. ;│           = 12h  Gus Ace                                                 │
  697. ;│           = 13h  Gus Pnp                                                 │
  698. ;│           = 20h  WSS                                                     │
  699. ;│        BX = Port                                                         │
  700. ;│        CX = Irq                                                          │
  701. ;│        DX = Dma                                                          │
  702. ;│        SI = Dsp Version (For Sb) ou                                      │
  703. ;│             Size of RAM of the Gravis                                    │
  704. ;│                                                                          │
  705. ;│Other Registers Change : None                                             │
  706. ;│                                                                          │
  707. ;│                                                                          │
  708. ;└──────────────────────────────────────────────────────────────────────────┘
  709. Detect_Sound_Card   = 30h
  710. If Impossible
  711.             mov ah,Detect_Sound_Card
  712.             mov cx,1
  713.             Int_EOS
  714. EndIf
  715.  
  716.  
  717. ;┌──────────────────────────────────────────────────────────────────────────┐
  718. ;│Load Module   Load a module & initialize into the memory                  │
  719. ;│                                                                          │
  720. ;│In :                                                                      │
  721. ;│        AH = Load_Module                                                  │
  722. ;│        AL = Bit 0 = 1  Load a internal module (can be compress and link  │
  723. ;│                        with LLINK)                                       │
  724. ;│           = Bit 1 = 1  Load module  from memory                          │
  725. ;│           = Bit 2 = 1  Force old mod Loading (15 instr)                  │
  726. ;│        BX = Replay rate (16000 to 44100 Hz)                              │
  727. ;│        CX = Number of Sfx Channel                                        │
  728. ;│        DS:EDX = Offset of Module name or                                 │
  729. ;│                 Offset into the memory of the beginning of the module    │
  730. ;│                                                                          │
  731. ;│Out :                                                                     │
  732. ;│        Carry = 0                                                         │
  733. ;│             All Done                                                     │
  734. ;│                                                                          │
  735. ;│        Carry = 1                                                         │
  736. ;│             Can't Load Module                                            │
  737. ;│                                                                          │
  738. ;│Other Registers Change : None                                             │
  739. ;│                                                                          │
  740. ;│                                                                          │
  741. ;└──────────────────────────────────────────────────────────────────────────┘
  742. Load_Module         = 32h
  743. If Impossible
  744.             mov ah,Load_Module
  745.             mov al,4+1
  746.             mov bx,22000
  747.             xor ecx,ecx
  748.             mov edx,O Module_Name
  749.             Int_EOS
  750.             jc Error_Loading_Module
  751. EndIf
  752.  
  753.  
  754. ;┌──────────────────────────────────────────────────────────────────────────┐
  755. ;│Play Module   Start playing the module                                    │
  756. ;│                                                                          │
  757. ;│In :                                                                      │
  758. ;│        AH = Play_Module                                                  │
  759. ;│                                                                          │
  760. ;│Out :                                                                     │
  761. ;│        Carry = 0                                                         │
  762. ;│             All Done                                                     │
  763. ;│                                                                          │
  764. ;│        Carry = 1                                                         │
  765. ;│             Can't Play Module                                            │
  766. ;│                                                                          │
  767. ;│Other Registers Change : None                                             │
  768. ;│                                                                          │
  769. ;│                                                                          │
  770. ;└──────────────────────────────────────────────────────────────────────────┘
  771. Play_Module         = 34h
  772. If Impossible
  773.             mov ah,Play_Module
  774.             Int_EOS
  775. EndIf
  776.  
  777.  
  778. ;┌──────────────────────────────────────────────────────────────────────────┐
  779. ;│Stop Module   Stop playing module                                         │
  780. ;│                                                                          │
  781. ;│In :                                                                      │
  782. ;│        AH = Stop_Module                                                  │
  783. ;│                                                                          │
  784. ;│Out :                                                                     │
  785. ;│                                                                          │
  786. ;│Other Registers Change : None                                             │
  787. ;│                                                                          │
  788. ;│                                                                          │
  789. ;└──────────────────────────────────────────────────────────────────────────┘
  790. Stop_Module         = 35h
  791. If Impossible
  792.             mov ah,Stop_Module
  793.             Int_EOS
  794. EndIf
  795.  
  796.  
  797. ;┌──────────────────────────────────────────────────────────────────────────┐
  798. ;│Clear Module   Unload the module from memory                              │
  799. ;│                                                                          │
  800. ;│In :                                                                      │
  801. ;│        AH = Clear_Module                                                 │
  802. ;│                                                                          │
  803. ;│Out :                                                                     │
  804. ;│                                                                          │
  805. ;│Other Registers Change : None                                             │
  806. ;│                                                                          │
  807. ;│                                                                          │
  808. ;└──────────────────────────────────────────────────────────────────────────┘
  809. Clear_Module        = 36h
  810. If Impossible
  811.             mov ah,Clear_Module
  812.             Int_EOS
  813. EndIf
  814.  
  815.  
  816. ;┌──────────────────────────────────────────────────────────────────────────┐
  817. ;│Manual Setup Sound Card                                                   │
  818. ;│                                                                          │
  819. ;│In :                                                                      │
  820. ;│        AH = Manual_Setup                                                 │
  821. ;│        AL = Type                                                         │
  822. ;│        BX = Port                                                         │
  823. ;│        CL = Irq1                                                         │
  824. ;│        CH = Irq2      ; Irq Gus 2                                        │
  825. ;│        DL = Dma1      ; Dma Gus 1 or Dma 8 Bits for SB                   │
  826. ;│        DH = Dma2      ; Dma Gus 2 or Dma 16 Bits for SB                  │
  827. ;│                                                                          │
  828. ;│Out :                                                                     │
  829. ;│        Carry Off                                                         │
  830. ;│        Init Ok                                                           │
  831. ;│                                                                          │
  832. ;│        Carry On                                                          │
  833. ;│        No Sound Card Found                                               │
  834. ;│                                                                          │
  835. ;└──────────────────────────────────────────────────────────────────────────┘
  836. Manual_Setup        = 37h
  837. If Impossible
  838.             mov ah,Manual_Setup
  839.             mov al,Gravis
  840.             mov bx,220h
  841.             mov cl,7
  842.             mov ch,7
  843.             mov dl,1
  844.             mov dh,1
  845.             Int_EOS
  846.             ...
  847.             mov ah,Manual_Setup
  848.             mov al,Sb_16
  849.             mov bx,220h
  850.             mov cl,7
  851.             mov dl,1
  852.             mov dh,5
  853.             Int_EOS
  854. EndIf
  855.  
  856.  
  857. ;┌──────────────────────────────────────────────────────────────────────────┐
  858. ;│Set Volume   Set the master volume of the module                          │
  859. ;│                                                                          │
  860. ;│In :                                                                      │
  861. ;│        AH = Set_Volume                                                   │
  862. ;│        CL = Volume (0 to 63)                                             │
  863. ;│        DL = Sfx Volume (0 to 63)                                         │
  864. ;│                                                                          │
  865. ;│Out :                                                                     │
  866. ;│                                                                          │
  867. ;│Other Registers Change : None                                             │
  868. ;│                                                                          │
  869. ;│                                                                          │
  870. ;└──────────────────────────────────────────────────────────────────────────┘
  871. Set_Volume          = 3ah
  872. If Impossible
  873.             mov ah,Set_Volume
  874.             mov cl,[New_Volume]
  875.             mov dl,[New_Volume_Sfx]
  876.             Int_EOS
  877. EndIf
  878.  
  879.  
  880. ;┌──────────────────────────────────────────────────────────────────────────┐
  881. ;│Play Sample   Play a sample include into the module                       │
  882. ;│                                                                          │
  883. ;│In :                                                                      │
  884. ;│        AH = Play_Sample                                                  │
  885. ;│        BX = Sample numbers                                               │
  886. ;│        CX = Sample Frequency                                             │
  887. ;│        DX = voice of sample                                              │
  888. ;│                                                                          │
  889. ;│Out :                                                                     │
  890. ;│                                                                          │
  891. ;│Other Registers Change : None                                             │
  892. ;│                                                                          │
  893. ;│                                                                          │
  894. ;└──────────────────────────────────────────────────────────────────────────┘
  895. Play_Sample         = 3bh
  896. If Impossible
  897.             mov ah,Play_Sample
  898.             mov bx,10
  899.             mov cx,15fh
  900.             mov dx,4
  901.             Int_EOS
  902. EndIf
  903.  
  904.  
  905. ;┌──────────────────────────────────────────────────────────────────────────┐
  906. ;│Get Info   Get information about the module when playing                  │
  907. ;│                                                                          │
  908. ;│In:                                                                       │
  909. ;│        AH = Get_Info                                                     │
  910. ;│                                                                          │
  911. ;│Out:                                                                      │
  912. ;│        AH = Position                                                     │
  913. ;│        AL = Pattern                                                      │
  914. ;│        BX = Note                                                         │
  915. ;│        CL = Master Volume                                                │
  916. ;│        DL = Master Volume Sfx                                            │
  917. ;│                                                                          │
  918. ;│                                                                          │
  919. ;│Other Registers Change : None                                             │
  920. ;│                                                                          │
  921. ;│                                                                          │
  922. ;└──────────────────────────────────────────────────────────────────────────┘
  923. Get_Info            = 3eh
  924. If Impossible
  925.             mov ah,Get_Info
  926.             Int_EOS
  927. EndIf
  928.  
  929.  
  930. ;┌──────────────────────────────────────────────────────────────────────────┐
  931. ;│Set Pattern  Set the current position of the playing module               │
  932. ;│                                                                          │
  933. ;│In:                                                                       │
  934. ;│        AH = Set_Pattern                                                  │
  935. ;│        BX = New_Position                                                 │
  936. ;│        CX = New_Note                                                     │
  937. ;│                                                                          │
  938. ;│Out:                                                                      │
  939. ;│                                                                          │
  940. ;│Other Registers Change : None                                             │
  941. ;│                                                                          │
  942. ;│                                                                          │
  943. ;└──────────────────────────────────────────────────────────────────────────┘
  944. Set_Pattern         = 3fh
  945. If Impossible
  946.             mov ah,Set_Pattern
  947.             mov bx,[New_Position]
  948.             mov cx,[New_Note]
  949.             Int_EOS
  950. EndIf
  951.  
  952.  
  953. ;╔══════════════════════════════════════════════════════════════════════════╗
  954. ;║                                                                          ║
  955. ;║                     Interrupt & Irq Functions                            ║
  956. ;║                                                                          ║
  957. ;╚══════════════════════════════════════════════════════════════════════════╝
  958.  
  959.  
  960. ;┌──────────────────────────────────────────────────────────────────────────┐
  961. ;│Get_Int       Get protected mode interrupt vector                         │
  962. ;│                                                                          │
  963. ;│In :                                                                      │
  964. ;│        AH = Get_Int                                                      │
  965. ;│        BX = Interrupt number                                             │
  966. ;│                                                                          │
  967. ;│Out :                                                                     │
  968. ;│    CX:EDX = Selector:Offset of interrupt                                 │
  969. ;│                                                                          │
  970. ;│Autre Registre Modifie : Aucun                                            │
  971. ;│                                                                          │
  972. ;│                                                                          │
  973. ;└──────────────────────────────────────────────────────────────────────────┘
  974. Get_Int             = 50h
  975. If Impossible
  976.             mov ah,Get_Int
  977.             mov bx,10h
  978.             Int_EOS
  979.             mov [Old_Int_10_Selector],cx
  980.             mov [Old_Int_10_Offset],edx
  981. EndIf
  982.  
  983.  
  984. ;┌──────────────────────────────────────────────────────────────────────────┐
  985. ;│Set_Int       Set protected mode interrupt vector                         │
  986. ;│                                                                          │
  987. ;│In :                                                                      │
  988. ;│        AH = Get_Int                                                      │
  989. ;│        BX = Interrupt number                                             │
  990. ;│    CX:EDX = Selector:Offset of interrupt                                 │
  991. ;│                                                                          │
  992. ;│Out :                                                                     │
  993. ;│                                                                          │
  994. ;│Autre Registre Modifie : Aucun                                            │
  995. ;│                                                                          │
  996. ;│                                                                          │
  997. ;└──────────────────────────────────────────────────────────────────────────┘
  998. Set_Int             = 51h
  999. If Impossible
  1000.             mov ah,Set_Int
  1001.             mov bx,10h
  1002.             mov cx,cs
  1003.             mov edx,O New_Int_10
  1004.             Int_EOS
  1005. EndIf
  1006.  
  1007.  
  1008. ;┌──────────────────────────────────────────────────────────────────────────┐
  1009. ;│Get_Irq       Get protected mode irq vector                               │
  1010. ;│                                                                          │
  1011. ;│In :                                                                      │
  1012. ;│        AH = Get_Irq                                                      │
  1013. ;│        BX = Irq number                                                   │
  1014. ;│                                                                          │
  1015. ;│Out :                                                                     │
  1016. ;│    CX:EDX = Selector:Offset of irq                                       │
  1017. ;│                                                                          │
  1018. ;│Autre Registre Modifie : Aucun                                            │
  1019. ;│                                                                          │
  1020. ;│                                                                          │
  1021. ;└──────────────────────────────────────────────────────────────────────────┘
  1022. Get_Irq             = 52h
  1023. If Impossible
  1024.             mov ah,Get_Irq
  1025.             mov bx,1h                               ; Keyboard
  1026.             Int_EOS
  1027.             mov [Old_Irq_01_Selector],cx
  1028.             mov [Old_Irq_01_Offset],edx
  1029. EndIf
  1030.  
  1031.  
  1032. ;┌──────────────────────────────────────────────────────────────────────────┐
  1033. ;│Set_Irq       Set protected mode irq vector                               │
  1034. ;│                                                                          │
  1035. ;│In :                                                                      │
  1036. ;│        AH = Get_Irq                                                      │
  1037. ;│        BX = Irq number                                                   │
  1038. ;│    CX:EDX = Selector:Offset of irq                                       │
  1039. ;│                                                                          │
  1040. ;│Out :                                                                     │
  1041. ;│                                                                          │
  1042. ;│Autre Registre Modifie : Aucun                                            │
  1043. ;│                                                                          │
  1044. ;│                                                                          │
  1045. ;└──────────────────────────────────────────────────────────────────────────┘
  1046. Set_Irq             = 53h
  1047. If Impossible
  1048.             mov ah,Set_Irq
  1049.             mov bx,1h                               ; Keybord
  1050.             mov cx,cs
  1051.             mov edx,O New_Irq_01
  1052.             Int_EOS
  1053. EndIf
  1054.  
  1055.  
  1056. ;╔══════════════════════════════════════════════════════════════════════════╗
  1057. ;║                                                                          ║
  1058. ;║                           Memory Allocation                              ║
  1059. ;║                                                                          ║
  1060. ;╚══════════════════════════════════════════════════════════════════════════╝
  1061.  
  1062.  
  1063. ;┌──────────────────────────────────────────────────────────────────────────┐
  1064. ;│Allocate Memory   Allocate Upper memory                                   │
  1065. ;│                                                                          │
  1066. ;│In :                                                                      │
  1067. ;│        AH = Allocate_Memory                                              │
  1068. ;│       EDX = Size of memory block to allocate in bytes                    │
  1069. ;│                                                                          │
  1070. ;│Out :                                                                     │
  1071. ;│        Carry = 0                                                         │
  1072. ;│             All Done                                                     │
  1073. ;│       EAX = Physical address of the block (work with Flat_Data_Sel)      │
  1074. ;│       EDX = Logical address of the block (work with Data32_Sel)          │
  1075. ;│                                                                          │
  1076. ;│        Carry = 1                                                         │
  1077. ;│             Can't allocate memory                                        │
  1078. ;│       EAX = Largest available free memory                                │
  1079. ;│       EDX = Total available memory                                       │
  1080. ;│                                                                          │
  1081. ;│Other Registers Change : None                                             │
  1082. ;│                                                                          │
  1083. ;│                                                                          │
  1084. ;└──────────────────────────────────────────────────────────────────────────┘
  1085. Allocate_Memory   = 40h
  1086. If Impossible
  1087.             mov ah,Allocate_Memory
  1088.             mov edx,[Allocation_Size]
  1089.             Int_EOS
  1090.             jc Not_Enough_Memory
  1091.             mov [Physical_Address_Of_Block],eax     ; Work with Flat_Data_Sel
  1092.             mov [Logical_Address_Of_Block],edx      ; Work with Data32_Sel
  1093. EndIf
  1094.  
  1095.  
  1096. ;┌──────────────────────────────────────────────────────────────────────────┐
  1097. ;│DeAllocate Memory   Free the last allocate memory                         │
  1098. ;│                                                                          │
  1099. ;│In :                                                                      │
  1100. ;│        AH = DeAllocate_Memory                                            │
  1101. ;│                                                                          │
  1102. ;│Out :                                                                     │
  1103. ;│                                                                          │
  1104. ;│Other Registers Change : None                                             │
  1105. ;│                                                                          │
  1106. ;│                                                                          │
  1107. ;└──────────────────────────────────────────────────────────────────────────┘
  1108. DeAllocate_Memory = 41h
  1109. If Impossible
  1110.             mov ah,DeAllocate_Memory
  1111.             Int_EOS
  1112. EndIf
  1113.  
  1114. ;┌──────────────────────────────────────────────────────────────────────────┐
  1115. ;│Allocate Memory Handle  Allocate Upper memory with handle                 │
  1116. ;│                                                                          │
  1117. ;│In :                                                                      │
  1118. ;│        AH = Allocate_Memory                                              │
  1119. ;│       EDX = Size of memory block to allocate in bytes                    │
  1120. ;│                                                                          │
  1121. ;│Out :                                                                     │
  1122. ;│        Carry = 0                                                         │
  1123. ;│             All Done                                                     │
  1124. ;│       EAX = Physical address of the block (work with Flat_Data_Sel)      │
  1125. ;│       EDX = Logical address of the block (work with Data32_Sel)          │
  1126. ;│       EDI = Handle of Memory                                             │
  1127. ;│                                                                          │
  1128. ;│        Carry = 1                                                         │
  1129. ;│             Can't allocate memory                                        │
  1130. ;│       EAX = Largest available free memory                                │
  1131. ;│       EDX = Total available memory                                       │
  1132. ;│                                                                          │
  1133. ;│Other Registers Change : None                                             │
  1134. ;│                                                                          │
  1135. ;│                                                                          │
  1136. ;└──────────────────────────────────────────────────────────────────────────┘
  1137. Allocate_Memory_Handle = 42h
  1138. If Impossible
  1139.             mov ah,Allocate_Memory_Handle
  1140.             mov edx,[Allocation_Size]
  1141.             Int_EOS
  1142.             jc Not_Enough_Memory
  1143.             mov [Physical_Address_Of_Block],eax     ; Work with Flat_Data_Sel
  1144.             mov [Logical_Address_Of_Block],edx      ; Work with Data32_Sel
  1145.             mov [Memory_Handle],edi
  1146. EndIf
  1147.  
  1148.  
  1149. ;┌──────────────────────────────────────────────────────────────────────────┐
  1150. ;│DeAllocate Memory Handle  Free the allocate memory with this handle       │
  1151. ;│                                                                          │
  1152. ;│In :                                                                      │
  1153. ;│        AH = DeAllocate_Memory                                            │
  1154. ;│       EDI = Handle of Memory                                             │
  1155. ;│                                                                          │
  1156. ;│Out :                                                                     │
  1157. ;│        Carry = 0                                                         │
  1158. ;│             All Done                                                     │
  1159. ;│                                                                          │
  1160. ;│        Carry = 1                                                         │
  1161. ;│             Invalid handle                                               │
  1162. ;│                                                                          │
  1163. ;│Other Registers Change : None                                             │
  1164. ;│                                                                          │
  1165. ;│                                                                          │
  1166. ;└──────────────────────────────────────────────────────────────────────────┘
  1167. DeAllocate_Memory_Handle = 43h
  1168. If Impossible
  1169.             mov ah,DeAllocate_Memory_Handle
  1170.             mov edi,[Memory_Handle]
  1171.             Int_EOS
  1172.             jc Invalid_Handle
  1173. EndIf
  1174.  
  1175. ;┌──────────────────────────────────────────────────────────────────────────┐
  1176. ;│Resize Memory Handle    Resize the allocate memory with this handle       │
  1177. ;│                                                                          │
  1178. ;│In :                                                                      │
  1179. ;│        AH = Resize_Memory_Handle                                         │
  1180. ;│       ECX = New Size of the memory block                                 │
  1181. ;│       EDI = Handle of Memory                                             │
  1182. ;│                                                                          │
  1183. ;│Out :                                                                     │
  1184. ;│        Carry = 0                                                         │
  1185. ;│             All Done                                                     │
  1186. ;│       EAX = Physical address of the block (work with Flat_Data_Sel)      │
  1187. ;│       EDX = Logical address of the block (work with Data32_Sel)          │
  1188. ;│       EDI = New Handle of Memory                                         │
  1189. ;│                                                                          │
  1190. ;│        Carry = 1                                                         │
  1191. ;│             Invalid handle                                               │
  1192. ;│             Not Enough Memory                                            │
  1193. ;│                                                                          │
  1194. ;│Other Registers Change : None                                             │
  1195. ;│                                                                          │
  1196. ;│                                                                          │
  1197. ;└──────────────────────────────────────────────────────────────────────────┘
  1198. Resize_Memory_Handle = 44h
  1199. If Impossible
  1200.             mov ah,Resize_Memory_Handle
  1201.             mov edi,[Memory_Handle]
  1202.             Int_EOS
  1203.             jc Invalid_Handle
  1204.             mov [Memory_Handle],edi
  1205.             mov [Addr_Memory],edx
  1206. EndIf
  1207.  
  1208.  
  1209. ;┌──────────────────────────────────────────────────────────────────────────┐
  1210. ;│Allocate Selector   Create a new selector (Data type)                     │
  1211. ;│                                                                          │
  1212. ;│In :                                                                      │
  1213. ;│        AH = Allocate_Selector                                            │
  1214. ;│       ESI = Physical base address of the new selector                    │
  1215. ;│       EDI = Size of the new selector modulo 4096                         │
  1216. ;│                                                                          │
  1217. ;│Out :                                                                     │
  1218. ;│        Carry = 0                                                         │
  1219. ;│             All Done                                                     │
  1220. ;│        BX = New selector                                                 │
  1221. ;│                                                                          │
  1222. ;│        Carry = 1                                                         │
  1223. ;│             Can't create selector                                        │
  1224. ;│                                                                          │
  1225. ;│Other Registers Change : EAX                                              │
  1226. ;│                                                                          │
  1227. ;│                                                                          │
  1228. ;└──────────────────────────────────────────────────────────────────────────┘
  1229. Allocate_Selector   = 45h
  1230. If Impossible
  1231.             mov ah,Allocate_Selector
  1232.             mov esi,0a0000h
  1233.             mov edi,0fh         ; 64ko (0000-ffff)
  1234.             Int_EOS
  1235.             jc No_Free Selector
  1236.             mov [_0a0000h_Sel],bx
  1237. EndIf
  1238.  
  1239.  
  1240. ;┌──────────────────────────────────────────────────────────────────────────┐
  1241. ;│DeAllocate Selector   Free a Selector                                     │
  1242. ;│                                                                          │
  1243. ;│In :                                                                      │
  1244. ;│        AH = DeAllocate_Selector                                          │
  1245. ;│        BX = Selector                                                     │
  1246. ;│                                                                          │
  1247. ;│Out :                                                                     │
  1248. ;│        Carry = 0                                                         │
  1249. ;│             All Done                                                     │
  1250. ;│                                                                          │
  1251. ;│        Carry = 1                                                         │
  1252. ;│             Can't deallocate selector                                    │
  1253. ;│                                                                          │
  1254. ;│Other Registers Change :  EAX,EBX                                         │
  1255. ;│                                                                          │
  1256. ;│                                                                          │
  1257. ;└──────────────────────────────────────────────────────────────────────────┘
  1258. DeAllocate_Selector = 46h
  1259. If Impossible
  1260.             mov ah,DeAllocate_Selector
  1261.             mov bx,[_0a0000h_Sel]
  1262.             Int_EOS
  1263.             jc Invalid_Selector
  1264. EndIf
  1265.  
  1266.  
  1267. ;┌──────────────────────────────────────────────────────────────────────────┐
  1268. ;│Physical Address Mapping                                                  │
  1269. ;│                                                                          │
  1270. ;│In :                                                                      │
  1271. ;│        AH = Physical_Address_Mapping                                     │
  1272. ;│       ECX = Size Of region                                               │
  1273. ;│       ESI = Physical address of memory                                   │
  1274. ;│                                                                          │
  1275. ;│Out :                                                                     │
  1276. ;│        Carry = 0                                                         │
  1277. ;│       ESI = Linear Address of the region                                 │
  1278. ;│             All Done                                                     │
  1279. ;│                                                                          │
  1280. ;│        Carry = 1                                                         │
  1281. ;│             No Room free                                                 │
  1282. ;│                                                                          │
  1283. ;│Other Registers Change : None                                             │
  1284. ;│                                                                          │
  1285. ;│                                                                          │
  1286. ;└──────────────────────────────────────────────────────────────────────────┘
  1287. Physical_Address_Mapping = 47h
  1288. If Impossible
  1289.             mov ah,Physical_Address_Mapping
  1290.             mov ecx,1024*1024
  1291.             mov esi,[Vesa_Linear_Address]
  1292.             Int_EOS
  1293.             jc Not_Enough_Memory
  1294. EndIf
  1295.  
  1296.  
  1297. ;┌──────────────────────────────────────────────────────────────────────────┐
  1298. ;│Free Physical Address Mapping      Free the allocate memory mapping       │
  1299. ;│                                                                          │
  1300. ;│In :                                                                      │
  1301. ;│        AH = Free_Address_Mapping                                         │
  1302. ;│       ESI = Address of the block to free                                 │
  1303. ;│                                                                          │
  1304. ;│Out :                                                                     │
  1305. ;│        Carry = 0                                                         │
  1306. ;│             All Done                                                     │
  1307. ;│                                                                          │
  1308. ;│        Carry = 1                                                         │
  1309. ;│             Invalid address                                              │
  1310. ;│                                                                          │
  1311. ;│Other Registers Change : None                                             │
  1312. ;│                                                                          │
  1313. ;│                                                                          │
  1314. ;└──────────────────────────────────────────────────────────────────────────┘
  1315. Free_Physical_Address_Mapping = 48h
  1316. If Impossible
  1317.             mov ah,Free_Physical_Address_Mapping
  1318.             mov esi,[Vesa_Linear_Address]
  1319.             Int_EOS
  1320.             jc Invalid_Address
  1321. EndIf
  1322.  
  1323.  
  1324.  
  1325.  
  1326. ;╔══════════════════════════════════════════════════════════════════════════╗
  1327. ;║                                                                          ║
  1328. ;║                      Monochrome Display                                  ║
  1329. ;║                                                                          ║
  1330. ;╚══════════════════════════════════════════════════════════════════════════╝
  1331.  
  1332.  
  1333. ;┌──────────────────────────────────────────────────────────────────────────┐
  1334. ;│Set Mono   Force On/Off the display of all the Monochrome Function        │
  1335. ;│                                                                          │
  1336. ;│In :                                                                      │
  1337. ;│        AH = Set_Mono                                                     │
  1338. ;│        BX = On  Force Monochrome Off                                     │
  1339. ;│             Off Force Monochrome On                                      │
  1340. ;│                                                                          │
  1341. ;│Out :                                                                     │
  1342. ;│                                                                          │
  1343. ;│Other Registers Change : None                                             │
  1344. ;│                                                                          │
  1345. ;│                                                                          │
  1346. ;└──────────────────────────────────────────────────────────────────────────┘
  1347. Set_Mono            = 0e0h
  1348. If Impossible
  1349.             mov ah,Set_Mono
  1350.             mov bx,On
  1351.             Int_EOS
  1352. EndIf
  1353.  
  1354.  
  1355. ;┌──────────────────────────────────────────────────────────────────────────┐
  1356. ;│Set String Mono   Display a string on the Monochrome adapter              │
  1357. ;│                                                                          │
  1358. ;│In :                                                                      │
  1359. ;│        AH = Set_String_Mono                                              │
  1360. ;│        BX = Coordonate  X                                                │
  1361. ;│        CX = Coordonate  Y                                                │
  1362. ;│       EDX = Address of text ending by $                                  │
  1363. ;│                                                                          │
  1364. ;│                                                                          │
  1365. ;│Out :                                                                     │
  1366. ;│                                                                          │
  1367. ;│Other Registers Change : None                                             │
  1368. ;│                                                                          │
  1369. ;│                                                                          │
  1370. ;└──────────────────────────────────────────────────────────────────────────┘
  1371. Set_String_Mono     = 0e1h
  1372. If Impossible
  1373.             mov ah,Set_String_Mono
  1374.             mov bx,1
  1375.             mov cx,10
  1376.             mov edx,offset text_mono
  1377.             Int_EOS
  1378. EndIf
  1379.  
  1380.  
  1381. ;┌──────────────────────────────────────────────────────────────────────────┐
  1382. ;│Set Value Mono   Display A Word in Hexadecimal on the Monochrome adapter  │
  1383. ;│                                                                          │
  1384. ;│In :                                                                      │
  1385. ;│        AH = Set_Value_Mono                                               │
  1386. ;│        BX = Coordonate X                                                 │
  1387. ;│        CX = Coordonate Y                                                 │
  1388. ;│        EDX = Value to be display                                         │
  1389. ;│                                                                          │
  1390. ;│                                                                          │
  1391. ;│Out :                                                                     │
  1392. ;│                                                                          │
  1393. ;│Other Registers Change : None                                             │
  1394. ;│                                                                          │
  1395. ;│                                                                          │
  1396. ;└──────────────────────────────────────────────────────────────────────────┘
  1397. Set_Value_Mono      = 0e2h
  1398. If Impossible
  1399.             mov ah,Set_Value_Mono
  1400.             mov bx,1
  1401.             mov cx,10
  1402.             mov dx,1234h
  1403.             Int_EOS
  1404. EndIf
  1405.  
  1406.  
  1407. ;╔══════════════════════════════════════════════════════════════════════════╗
  1408. ;║                                                                          ║
  1409. ;║ EOS Library                                                              ║
  1410. ;║                                                                          ║
  1411. ;╚══════════════════════════════════════════════════════════════════════════╝
  1412.  
  1413.  
  1414. ;╔══════════════════════════════════════════════════════════════════════════╗
  1415. ;║                                                                          ║
  1416. ;║ VESA                                                                     ║
  1417. ;║                                                                          ║
  1418. ;╚══════════════════════════════════════════════════════════════════════════╝
  1419.  
  1420. Global Init_Vesa            : Proc
  1421. Global Init_Vesa2           : Proc
  1422. Global Set_Bank             : Proc
  1423. Global Next_Bank            : Proc
  1424. Global Vesa_Current_Bank    : Byte
  1425.  
  1426. Global Init_Vesa_Bank       : Proc
  1427. Global Close_Vesa_Bank      : Proc
  1428.  
  1429. Global Vesa_Clear_Palette   : Byte
  1430.  
  1431. ; ------------ VBE v1.0  ------------------
  1432. Mode640x400x256             = 100h
  1433. Mode640x480x256             = 101h
  1434. Mode800x600x16              = 102h
  1435. Mode800x600x256             = 103h
  1436. Mode1024x768x16             = 104h
  1437. Mode1024x768x256            = 105h
  1438. Mode1280x1024x16            = 106h
  1439. Mode1280x1024x256           = 107h
  1440. Mode80x60                   = 108h
  1441. Mode132x25                  = 109h
  1442. Mode132x43                  = 10ah
  1443. Mode132x60                  = 10bh
  1444. Mode132x60                  = 10ch
  1445. ; ------------ VBE v1.2+ ------------------
  1446. Mode320x200x32k             = 10dh
  1447. Mode320x200x64k             = 10eh
  1448. Mode320x200x16M             = 10fh
  1449. Mode640x480x32k             = 110h
  1450. Mode640x480x64k             = 111h
  1451. Mode640x480x16M             = 112h
  1452. Mode800x600x32k             = 113h
  1453. Mode800x600x64k             = 114h
  1454. Mode800x600x16M             = 115h
  1455. Mode1024x768x32k            = 116h
  1456. Mode1024x768x64k            = 117h
  1457. Mode1024x768x16M            = 118h
  1458. Mode1280x1024x32k           = 119h
  1459. Mode1280x1024x64k           = 11ah
  1460. Mode1280x1024x16M           = 11bh
  1461.  
  1462. ;┌──────────────────────────────────────────────────────────────────────────┐
  1463. ;│Init Vesa   Initialize A Vesa 1.x or 2.0 to use automatic bank switching  │
  1464. ;│                                                                          │
  1465. ;│In :                                                                      │
  1466. ;│        EAX = Vesa mode                                                   │
  1467. ;│                                                                          │
  1468. ;│Out :                                                                     │
  1469. ;│        EAX = VRAM address                                                │
  1470. ;│                                                                          │
  1471. ;│        Carry = 0                                                         │
  1472. ;│             All Done                                                     │
  1473. ;│                                                                          │
  1474. ;│        Carry = 1                                                         │
  1475. ;│             Mode Vesa not supported or Vesa driver not found             │
  1476. ;│                                                                          │
  1477. ;└──────────────────────────────────────────────────────────────────────────┘
  1478. If Impossible
  1479.             mov eax,Mode640x480x256
  1480.             call Init_Vesa
  1481.             jc Error_Vesa
  1482.  
  1483.             ...
  1484.  
  1485. Vesa_Txt            db '    ■ Mode SVGA not supported or VESA not found !',13,10
  1486.                     db '      To install a vesa driver, refer to your video card documentation.',13,10,36
  1487. EndIf
  1488.  
  1489.  
  1490. ;┌──────────────────────────────────────────────────────────────────────────┐
  1491. ;│Init Vesa2  Initialize A Vesa 2.0 to use linear frame buffer              │
  1492. ;│                                                                          │
  1493. ;│In :                                                                      │
  1494. ;│        EAX = Vesa mode                                                   │
  1495. ;│        ECX = Video buffer size                                           │
  1496. ;│                                                                          │
  1497. ;│Out :                                                                     │
  1498. ;│        EAX = Linear buffer address                                       │
  1499. ;│                                                                          │
  1500. ;│        Carry = 0                                                         │
  1501. ;│             All Done                                                     │
  1502. ;│                                                                          │
  1503. ;│        Carry = 1                                                         │
  1504. ;│             Mode Vesa not supported or Vesa driver not found             │
  1505. ;│                                                                          │
  1506. ;└──────────────────────────────────────────────────────────────────────────┘
  1507. If Impossible
  1508.             mov eax,Mode640x480x256
  1509.             mov ecx,640*480
  1510.             call Init_Vesa2
  1511.             jc Error_Vesa
  1512.             mov [Screen],eax
  1513.  
  1514.             ...
  1515.  
  1516. Vesa_Txt            db '    ■ Mode SVGA not supported or VESA not found !',13,10
  1517.                     db '      To install a vesa driver, refer to your video card documentation.',13,10,36
  1518. EndIf
  1519.  
  1520.  
  1521. ;┌──────────────────────────────────────────────────────────────────────────┐
  1522. ;│Init Vesa Bank  Init the Automatic Bank Switching                         │
  1523. ;│                                                                          │
  1524. ;│In :                                                                      │
  1525. ;│                                                                          │
  1526. ;│Out :                                                                     │
  1527. ;│        Carry = 0                                                         │
  1528. ;│             All Done                                                     │
  1529. ;│       BX = New selector for addressing the video ram                     │
  1530. ;│                                                                          │
  1531. ;│        Carry = 1                                                         │
  1532. ;│             Can't allocate selector                                      │
  1533. ;│                                                                          │
  1534. ;└──────────────────────────────────────────────────────────────────────────┘
  1535. If Impossible
  1536.             call Init_Vesa_Bank
  1537.             jc Error_Sel
  1538.             mov [screen_selector],bx
  1539.  
  1540.             ...
  1541.  
  1542.             mov edx,edi     ; EDI Address of first pixel to be display
  1543.             shr edx,16
  1544.             call Set_Bank
  1545.             and edi,0ffffh
  1546.  
  1547.             ...
  1548.  
  1549.             call Close_Vesa_Bank
  1550. EndIf
  1551.  
  1552.  
  1553. ;╔══════════════════════════════════════════════════════════════════════════╗
  1554. ;║                                                                          ║
  1555. ;║ FLI32                                                                    ║
  1556. ;║                                                                          ║
  1557. ;╚══════════════════════════════════════════════════════════════════════════╝
  1558.  
  1559. Global Load_Fli             : Proc
  1560. Global Load_Internal_Fli    : Proc
  1561. Global Dispose_Fli          : Proc
  1562.  
  1563. Global First_Frame_Fli      : Proc
  1564. Global Next_Frame_Fli       : Proc
  1565.  
  1566. Global Fli_Err              : Byte
  1567. Global Fli_Svga             : Byte
  1568. Global Fli_Swap             : Byte
  1569.  
  1570. Global Fli_ReStart          : Byte
  1571. Global Fli_Loop             : Byte
  1572. Global Fli_TrackDisk        : Byte
  1573. Global Fli_Last_Frame       : Byte
  1574.  
  1575. Global Fli_Delay            : Dword
  1576. Global Fli_Buffer           : Dword
  1577.  
  1578. Global Fli_Ligne_Shl        : Byte
  1579. Global Fli_Scr_X            : Dword
  1580. Global Fli_Scr_Y            : Dword
  1581. Global Fli_Decal_Y          : Dword
  1582. Global Fli_Decal_X          : Dword
  1583.  
  1584. Global Fli_Selector         : Word
  1585.  
  1586. Global Fli_Current_Frame    : Dword
  1587.  
  1588. ;┌──────────────────────────────────────────────────────────────────────────┐
  1589. ;│Play a FLI/FLC files                                                      │
  1590. ;│                                                                          │
  1591. ;│Functions :                                                               │
  1592. ;│                                                                          │
  1593. ;│        Load_Fli          Load a FLI into the memory                      │
  1594. ;│                          Initialize if needed the track-disk mode        │
  1595. ;│                          check the header                                │
  1596. ;│                                                                          │
  1597. ;│        Load_Internal_Fli Load a FLI which is link with LLINK             │
  1598. ;│                          check the header                                │
  1599. ;│                                                                          │
  1600. ;│        First_Frame_Fli   Uncompress the first frame                      │
  1601. ;│                                                                          │
  1602. ;│        Next_Frame_Fli    Uncompress next frame                           │
  1603. ;│                                                                          │
  1604. ;│        Dispose_Fli       Freeing memory                                  │
  1605. ;│                          Close File                                      │
  1606. ;│                                                                          │
  1607. ;│Information During playing :                                              │
  1608. ;│                                                                          │
  1609. ;│        Fli_Err       = 1 - Chunk not found                               │
  1610. ;│                        2 - Out of memory                                 │
  1611. ;│                        3 - File error                                    │
  1612. ;│                        4 - Bad FLC header                                │
  1613. ;│                        5 - Size max for FLC : 640x480                    │
  1614. ;│                                                                          │
  1615. ;│        Fli_Swap      = On - Track disk running - not enough memory to    │
  1616. ;│                             load the file                                │
  1617. ;│                        Off- File has been load into memory               │
  1618. ;│                                                                          │
  1619. ;│        Fli_Svga      = On - Number of Ligne >200                         │
  1620. ;│                                                                          │
  1621. ;│        Fli_Delay     = Fli speed                                         │
  1622. ;│                                                                          │
  1623. ;│        Fli_Last_Frame= On - Last frame (Mode No looping)                 │
  1624. ;│                                                                          │
  1625. ;│Commands :                                                                │
  1626. ;│                                                                          │
  1627. ;│        Fli_Selector  = Screen selector                                   │
  1628. ;│                                                                          │
  1629. ;│        Fli_ReStart   = On - Restart at the begining of the animation     │
  1630. ;│                                                                          │
  1631. ;│        Fli_Loop      = On - Restart the FLI at the end (Defaults)        │
  1632. ;│                        Off- Stop at the end  (Mode No looping)           │
  1633. ;│                                                                          │
  1634. ;│        Fli_TrackDisk = On - Enable Track-Disk mode                       │
  1635. ;│                        Off- Track-Disk not use execpt when the FLI can't │
  1636. ;│                             be load into the memory                      │
  1637. ;│                                                                          │
  1638. ;│        Fli_Buffer    = Logical address of FLI buffer                     │
  1639. ;│                                                                          │
  1640. ;└──────────────────────────────────────────────────────────────────────────┘
  1641. If Impossible
  1642.             mov edx, offset Fli_Path
  1643.             call Load_Fli
  1644.             jc Fli_Error
  1645.  
  1646.             cmp Fli_Svga,On
  1647.             je  @@Init_Svga
  1648.             jne @@Init_Vga
  1649.  
  1650.             ...
  1651.  
  1652.             mov Fli_Selector,[screen_selector]
  1653.  
  1654.             call First_Frame_Fli
  1655.             jc Fli_Error
  1656.  
  1657. @@again:
  1658.             mov ah,Wait_Vbl
  1659.             Int_EOS
  1660.  
  1661.             call Next_Frame_Fli
  1662.             jc Fli_Error
  1663.  
  1664.             cmp Key_Map[Escape],On
  1665.             jne @@again
  1666. endif
  1667.  
  1668.  
  1669. ;╔══════════════════════════════════════════════════════════════════════════╗
  1670. ;║                                                                          ║
  1671. ;║ SNAP                                                                     ║
  1672. ;║                                                                          ║
  1673. ;╚══════════════════════════════════════════════════════════════════════════╝
  1674.  
  1675. ;┌──────────────────────────────────────────────────────────────────────────┐
  1676. ;│Snap        Grab a 256 Colors screen in Non-Mode and save it in IFF format│
  1677. ;│            Scroll Lock to lunch it                                       │
  1678. ;└──────────────────────────────────────────────────────────────────────────┘
  1679.  
  1680. ;┌──────────────────────────────────────────────────────────────────────────┐
  1681. ;│Init Snap   Initialize the screen grabber . (You can change the int 09    │
  1682. ;│            function Use_Int_09 after this Init                           │
  1683. ;│                                                                          │
  1684. ;│In :                                                                      │
  1685. ;│                                                                          │
  1686. ;│Out :                                                                     │
  1687. ;│                                                                          │
  1688. ;└──────────────────────────────────────────────────────────────────────────┘
  1689.  
  1690. Global Init_Snap    : Proc
  1691.  
  1692.  
  1693. ;┌──────────────────────────────────────────────────────────────────────────┐
  1694. ;│Snap IFF    Grab the current Screen from Video RAM                        │
  1695. ;│                                                                          │
  1696. ;│In :                                                                      │
  1697. ;│                                                                          │
  1698. ;│Out :                                                                     │
  1699. ;│                                                                          │
  1700. ;└──────────────────────────────────────────────────────────────────────────┘
  1701.  
  1702. Global Snap_Iff     : Proc
  1703.  
  1704.  
  1705. ;┌──────────────────────────────────────────────────────────────────────────┐
  1706. ;│Save IFF    Save a buffer to IFF                                          │
  1707. ;│                                                                          │
  1708. ;│In :                                                                      │
  1709. ;│        AX = Screen Size X                                                │
  1710. ;│        BX = Screen Size Y                                                │
  1711. ;│       EDX = Offset of File Name                                          │
  1712. ;│       ESI = Address to save in IFF                                       │
  1713. ;│                                                                          │
  1714. ;│Out :                                                                     │
  1715. ;│                                                                          │
  1716. ;└──────────────────────────────────────────────────────────────────────────┘
  1717.  
  1718. Global Save_Iff     : Proc
  1719.  
  1720.  
  1721. ;╔══════════════════════════════════════════════════════════════════════════╗
  1722. ;║                                                                          ║
  1723. ;║ JOYSTICK                                                                 ║
  1724. ;║                                                                          ║
  1725. ;╚══════════════════════════════════════════════════════════════════════════╝
  1726.  
  1727. Analog_A            = 1h
  1728. Analog_B            = 2h
  1729. Lpt_A               = 10h
  1730. Lpt_B               = 20h
  1731.  
  1732. Lpt1                = 1h
  1733. Lpt2                = 2h
  1734. Lpt3                = 3h
  1735. Lpt4                = 4h
  1736.  
  1737. Joy         Struc
  1738. J_Type              db 0
  1739. J_Addr              dw 0
  1740. J_Value_X           dd 0
  1741. J_Value_Y           dd 0
  1742. J_Min_X             dd 0
  1743. J_Max_X             dd 0
  1744. J_Min_Y             dd 0
  1745. J_Max_Y             dd 0
  1746. J_Center_X          dd 0
  1747. J_Center_Y          dd 0
  1748. J_Calibrate_Left    dd 0
  1749. J_Calibrate_Right   dd 0
  1750. J_Calibrate_Up      dd 0
  1751. J_Calibrate_Down    dd 0
  1752. J_Current_Left      db 0
  1753. J_Current_Right     db 0
  1754. J_Current_Up        db 0
  1755. J_Current_Down      db 0
  1756. J_Fire_1            db 0
  1757. J_Fire_2            db 0
  1758. J_Fire_3            db 0
  1759. J_Fire_4            db 0
  1760.             ends
  1761.  
  1762.  
  1763. ;┌──────────────────────────────────────────────────────────────────────────┐
  1764. ;│Init_Joystick  Init all port en address                                   │
  1765. ;│                                                                          │
  1766. ;│In :                                                                      │
  1767. ;│                                                                          │
  1768. ;│Out :                                                                     │
  1769. ;│                                                                          │
  1770. ;│Other Registers Change : None                                             │
  1771. ;│                                                                          │
  1772. ;└──────────────────────────────────────────────────────────────────────────┘
  1773.  
  1774. Global      Init_Joystick   : Proc
  1775.  
  1776.  
  1777. ;┌──────────────────────────────────────────────────────────────────────────┐
  1778. ;│Dectect_Joystick  Find if a analogic joystick is plug in port 1 ,2 or Both│
  1779. ;│                                                                          │
  1780. ;│In :                                                                      │
  1781. ;│                                                                          │
  1782. ;│Out :                                                                     │
  1783. ;│        Carry = 0                                                         │
  1784. ;│             All Done                                                     │
  1785. ;│       EAX = 1 A joystick is plug in port 1                               │
  1786. ;│             2 A joystick is plug in port 2                               │
  1787. ;│             3 2 joystick is plug in port 1 and 2                         │
  1788. ;│                                                                          │
  1789. ;│        Carry = 1                                                         │
  1790. ;│             No Joystick                                                  │
  1791. ;│                                                                          │
  1792. ;│Other Registers Change : None                                             │
  1793. ;│                                                                          │
  1794. ;└──────────────────────────────────────────────────────────────────────────┘
  1795.  
  1796. Global      Detect_Joystick : Proc
  1797.  
  1798.  
  1799. ;┌──────────────────────────────────────────────────────────────────────────┐
  1800. ;│Add_Joystick   Add a new joystick to be use by the library                │
  1801. ;│                                                                          │
  1802. ;│In :                                                                      │
  1803. ;│        AX = Type Of joystick                                             │
  1804. ;│             Analog_A                                                     │
  1805. ;│             Analog_B                                                     │
  1806. ;│             Lpt_A                                                        │
  1807. ;│             Lpt_B                                                        │
  1808. ;│        BX = Address of port                                              │
  1809. ;│           = 1 Lpt1                                                       │
  1810. ;│           = 2 Lpt2                                                       │
  1811. ;│           = 3 Lpt3                                                       │
  1812. ;│           = 4 Lpt4                                                       │
  1813. ;│                                                                          │
  1814. ;│Out :                                                                     │
  1815. ;│        Carry = 0                                                         │
  1816. ;│             All Done                                                     │
  1817. ;│       ESI = Address of structure of joystick                             │
  1818. ;│                                                                          │
  1819. ;│        Carry = 1                                                         │
  1820. ;│             No Joystick Available                                        │
  1821. ;│                                                                          │
  1822. ;│Other Registers Change : None                                             │
  1823. ;│                                                                          │
  1824. ;└──────────────────────────────────────────────────────────────────────────┘
  1825.  
  1826. Global      Add_Joystick    : Proc
  1827.  
  1828.  
  1829. ;┌──────────────────────────────────────────────────────────────────────────┐
  1830. ;│Update_Joystick  Must be call often update all structure of all Joystick  │
  1831. ;│                 declare with Add_Joystick                                │
  1832. ;│                                                                          │
  1833. ;│In :                                                                      │
  1834. ;│                                                                          │
  1835. ;│Out :                                                                     │
  1836. ;│                                                                          │
  1837. ;│Other Registers Change : None                                             │
  1838. ;│                                                                          │
  1839. ;└──────────────────────────────────────────────────────────────────────────┘
  1840.  
  1841. Global      UpDate_Joystick : Proc
  1842.  
  1843.  
  1844. ;┌──────────────────────────────────────────────────────────────────────────┐
  1845. ;│Sub_Joystick   Delete a Joystick create by Add_Joystick                   │
  1846. ;│                                                                          │
  1847. ;│In :                                                                      │
  1848. ;│       ESI = Address of structure to be delete                            │
  1849. ;│                                                                          │
  1850. ;│Out :                                                                     │
  1851. ;│        Carry = 0                                                         │
  1852. ;│             All Done                                                     │
  1853. ;│                                                                          │
  1854. ;│        Carry = 1                                                         │
  1855. ;│             Structure not found                                          │
  1856. ;│                                                                          │
  1857. ;│Other Registers Change : None                                             │
  1858. ;│                                                                          │
  1859. ;└──────────────────────────────────────────────────────────────────────────┘
  1860.  
  1861. Global      Sub_Joystick : Proc
  1862.  
  1863.  
  1864. ;┌──────────────────────────────────────────────────────────────────────────┐
  1865. ;│Upper_Left     Take Value For Upper Left Joystick's Coordonate            │
  1866. ;│                                                                          │
  1867. ;│In :                                                                      │
  1868. ;│       ESI = Address of structure                                         │
  1869. ;│                                                                          │
  1870. ;│Out :                                                                     │
  1871. ;│        Carry = 0                                                         │
  1872. ;│             All Done                                                     │
  1873. ;│                                                                          │
  1874. ;│        Carry = 1                                                         │
  1875. ;│             No Fire Press                                                │
  1876. ;│                                                                          │
  1877. ;│                                                                          │
  1878. ;│Other Registers Change : None                                             │
  1879. ;│                                                                          │
  1880. ;└──────────────────────────────────────────────────────────────────────────┘
  1881.  
  1882. Global      Upper_Left      : Proc
  1883.  
  1884.  
  1885. ;┌──────────────────────────────────────────────────────────────────────────┐
  1886. ;│Lower_Right    Take Value For Lower Right Joystick's Coordonate           │
  1887. ;│                                                                          │
  1888. ;│In :                                                                      │
  1889. ;│       ESI = Address of structure                                         │
  1890. ;│                                                                          │
  1891. ;│Out :                                                                     │
  1892. ;│        Carry = 0                                                         │
  1893. ;│             All Done                                                     │
  1894. ;│                                                                          │
  1895. ;│        Carry = 1                                                         │
  1896. ;│             No Fire Press                                                │
  1897. ;│                                                                          │
  1898. ;│                                                                          │
  1899. ;│Other Registers Change : None                                             │
  1900. ;│                                                                          │
  1901. ;└──────────────────────────────────────────────────────────────────────────┘
  1902.  
  1903. Global      Lower_Right     : Proc
  1904.  
  1905.  
  1906. ;┌──────────────────────────────────────────────────────────────────────────┐
  1907. ;│Center         Take Value For Center Joystick's Coordonate                │
  1908. ;│                                                                          │
  1909. ;│In :                                                                      │
  1910. ;│       ESI = Address of structure                                         │
  1911. ;│                                                                          │
  1912. ;│Out :                                                                     │
  1913. ;│        Carry = 0                                                         │
  1914. ;│             All Done                                                     │
  1915. ;│                                                                          │
  1916. ;│        Carry = 1                                                         │
  1917. ;│             No Fire Press                                                │
  1918. ;│                                                                          │
  1919. ;│                                                                          │
  1920. ;│Other Registers Change : None                                             │
  1921. ;│                                                                          │
  1922. ;└──────────────────────────────────────────────────────────────────────────┘
  1923.  
  1924. Global      Center          : Proc
  1925.  
  1926.  
  1927. ;╔══════════════════════════════════════════════════════════════════════════╗
  1928. ;║                                                                          ║
  1929. ;║ MEMORY                                                                   ║
  1930. ;║                                                                          ║
  1931. ;╚══════════════════════════════════════════════════════════════════════════╝
  1932.  
  1933.  
  1934. ;┌──────────────────────────────────────────────────────────────────────────┐
  1935. ;│Init_Memory    Turn the display memory on                                 │
  1936. ;│                                                                          │
  1937. ;│In :                                                                      │
  1938. ;│                                                                          │
  1939. ;│Out :                                                                     │
  1940. ;│                                                                          │
  1941. ;│Other Registers Change : None                                             │
  1942. ;│                                                                          │
  1943. ;└──────────────────────────────────────────────────────────────────────────┘
  1944.  
  1945. Global      Init_Memory     : Proc
  1946.  
  1947.  
  1948. ;╔══════════════════════════════════════════════════════════════════════════╗
  1949. ;║                                                                          ║
  1950. ;║ Macros used for calling the real mode                                    ║
  1951. ;║                                                                          ║
  1952. ;╚══════════════════════════════════════════════════════════════════════════╝
  1953.  
  1954. Global     Real_GS                 :dword
  1955. Global     Real_FS                 :dword
  1956. Global     Real_DS                 :dword
  1957. Global     Real_ES                 :dword
  1958. Global     Real_SS                 :dword
  1959. Global     Real_SP                 :dword
  1960.  
  1961. Int_Val_DOS = 62h
  1962. Int_Val_Call= 63h
  1963.  
  1964. DosInt     macro Int_Number
  1965.             push Int_Number
  1966.             int Int_Val_DOS
  1967.            endm
  1968.  
  1969. DosCALL    macro _Seg_,_Ofs_
  1970.            IFB <_Ofs_>
  1971.             push D _Seg_
  1972.            ELSE
  1973.             push W _Seg_
  1974.             push W _Ofs_
  1975.            ENDIF
  1976.             int Int_Val_Call
  1977.            endm
  1978.  
  1979. Init_es_di  macro Adrs
  1980.             mov edi,[code32_addr]
  1981.             add edi,O Adrs
  1982.             shr edi,4
  1983.             mov real_es,edi
  1984.             lea edi,Adrs
  1985.             and edi,0fh
  1986.             endm
  1987.  
  1988. Init_ds_dx  macro Adrs
  1989.             mov edx,[code32_addr]
  1990.             add edx,O Adrs
  1991.             shr edx,4
  1992.             mov real_ds,edx
  1993.             lea edx,Adrs
  1994.             and edx,0fh
  1995.             endm
  1996.  
  1997.  
  1998. ;╔══════════════════════════════════════════════════════════════════════════╗
  1999. ;║                                                                          ║
  2000. ;║ Miscellaneous                                                            ║
  2001. ;║                                                                          ║
  2002. ;╚══════════════════════════════════════════════════════════════════════════╝
  2003.  
  2004.  
  2005. Global       Code32_Sel              :word
  2006. Global       Data32_Sel              :word
  2007. Global       Flat_Data_Sel           :word
  2008. Global       Flat_Code_Sel           :word
  2009. Global       Environment_Addr        :dword
  2010. Global       Psp_Addr                :dword
  2011. Global       _0b0000h                :dword
  2012. Global       _0b8000h                :dword
  2013. Global       _0a0000h                :dword
  2014. Global       Code32_Addr             :dword
  2015. Global       Zero_Addr               :dword
  2016. Global       Start32                 :proc
  2017. Global       Server_Type             :Byte
  2018.  
  2019. ;╔══════════════════════════════════════════════════════════════════════════╗
  2020. ;║                                                                          ║
  2021. ;║ The 32bit debugger                                                       ║
  2022. ;║                                                                          ║
  2023. ;╚══════════════════════════════════════════════════════════════════════════╝
  2024.  
  2025. Global       Debug                   :proc
  2026. Global       Debug_Back              :proc
  2027.  
  2028. ;╔══════════════════════════════════════════════════════════════════════════╗
  2029. ;║                                                                          ║
  2030. ;║ The EOS Emutation when using WATCON                                      ║
  2031. ;║                                                                          ║
  2032. ;╚══════════════════════════════════════════════════════════════════════════╝
  2033.  
  2034. Global       Init_EOS                :proc